package io.sage.modules.sys.entity;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableLogic;
import com.baomidou.mybatisplus.annotations.TableName;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;


/**
 * 部门管理
 * 
 * @author xujh
 */
@TableName("sys_dept")
public class SysDeptEntity implements Serializable,Comparable<SysDeptEntity> {
	private static final long serialVersionUID = 1L;
	
	//部门ID
	@TableId
	private Long deptId;
	//上级部门ID，一级部门为0
	private Long parentId;
	//部门名称
	private String name;
	//部门等级
	private Integer leve;
	//部门编号
	private String deptNo;
	//上级部门名称
	@TableField(exist=false)
	private String parentName;
	//排序
	private Integer orderNum;

	@TableLogic
	private Integer delFlag;
	/**
	 * ztree属性
	 */
	@TableField(exist=false)
	private Boolean open;
	@TableField(exist=false)
	private List<SysDeptEntity> list;


	@TableField(exist = false)
	private  String label;

	@TableField(exist = false)
	private String value;

	@TableField(exist = false)
	private List<SysDeptEntity> children;

	@TableField(exist = false)
	private  Double latitude;

	@TableField(exist = false)
	private Double longitude;




	public void setDeptId(Long deptId) {
		this.deptId = deptId;
	}

	public Long getDeptId() {
		return deptId;
	}
	/**
	 * 设置：上级部门ID，一级部门为0
	 */
	public void setParentId(Long parentId) {
		this.parentId = parentId;
	}
	/**
	 * 获取：上级部门ID，一级部门为0
	 */
	public Long getParentId() {
		return parentId;
	}
	/**
	 * 设置：部门名称
	 */
	public void setName(String name) {
		this.name = name;
	}
	/**
	 * 获取：部门名称
	 */
	public String getName() {
		return name;
	}
	
	/**
	 * 设置：排序
	 */
	public void setOrderNum(Integer orderNum) {
		this.orderNum = orderNum;
	}
	/**
	 * 获取：排序
	 */
	public Integer getOrderNum() {
		return orderNum;
	}

	public Integer getDelFlag() {
		return delFlag;
	}

	public void setDelFlag(Integer delFlag) {
		this.delFlag = delFlag;
	}

	public String getParentName() {
		return parentName;
	}

	public void setParentName(String parentName) {
		this.parentName = parentName;
	}

	public Boolean getOpen() {
		return open;
	}

	public void setOpen(Boolean open) {
		this.open = open;
	}

	public List<SysDeptEntity> getList() {
		return list;
	}

	public void setList(List<SysDeptEntity> list) {
		this.list = list;
	}

	public Integer getLeve() {
		return leve;
	}

	public void setLeve(Integer leve) {
		this.leve = leve;
	}

	public String getDeptNo() {
		return deptNo;
	}

	public void setDeptNo(String deptNo) {
		this.deptNo = deptNo;
	}

	@Override
	public int compareTo(SysDeptEntity sysDeptEntity) {           //重写Comparable接口的compareTo方法，
		return Integer.parseInt(this.deptNo) - Integer.parseInt(sysDeptEntity.getDeptNo());// 根据deptNo升序排列，降序修改相减顺序即可
	}

	public String getLabel() {
		return this.name;
	}



	public String getValue() {
		return this.deptId.toString();
	}

	public List<SysDeptEntity> getChildren() {
		return this.list==null?new ArrayList<>():this.list;
	}

	public Double getLatitude() {
		return latitude;
	}

	public void setLatitude(Double latitude) {
		this.latitude = latitude;
	}

	public Double getLongitude() {
		return longitude;
	}

	public void setLongitude(Double longitude) {
		this.longitude = longitude;
	}
}
